package evol;

import ia.battle.camp.*;
import ia.exceptions.RuleException;

public class WarriorJ extends Warrior {

	public WarriorJ(String name, int health, int defense, int strength,
			int speed, int range) throws RuleException {
		super(name, health, defense, strength, speed, range);
	}

	@Override
	public Action playTurn(long tick, int actionNumber) {
		//todo: turno 1 y 0 agregar ataque al 0 y movimiento al 1 y acomodar esto.
		int cSpeed = this.getSpeed() / 5; // para saber cuantos pasos me quedan.
		if (actionNumber == 0) {
			// WarriorMoveRandom m = new WarriorMoveRandom();
			if (!BattleField.getInstance().getEnemyData().getInRange()) {
				WarriorMoveA m = new WarriorMoveA();
				m.setDestino(this.getPosition(), BattleField.getInstance()
						.getEnemyData().getFieldCell());
				cSpeed -= m.move().size();
				return m;

			}else{
				Attack a = new Attack(BattleField.getInstance().getEnemyData().getFieldCell());
				return a;
			}

		} else if (actionNumber == 1) {
			if (!BattleField.getInstance().getEnemyData().getInRange()) {
				WarriorMoveA m = new WarriorMoveA();
				m.setDestino(this.getPosition(), BattleField.getInstance()
						.getEnemyData().getFieldCell());
				cSpeed -= m.move().size();
				return m;

			}else{
				Attack a = new Attack(BattleField.getInstance().getEnemyData().getFieldCell());
				return a;
			}
		} else if (actionNumber == 2) {
			if (!BattleField.getInstance().getEnemyData().getInRange()) {
				WarriorMoveA m = new WarriorMoveA();
				m.setDestino(this.getPosition(), BattleField.getInstance()
						.getEnemyData().getFieldCell());
				cSpeed -= m.move().size();
				return m;

			}else{
				Attack a = new Attack(BattleField.getInstance().getEnemyData().getFieldCell());
				return a;
			}

		}
		return null;

	}

	

}
